below is the code which fetches campus id and campus name form the mysql database and store them in two variables and using while loop i had fetch all the records from the Related table (Campus) by the code below
Expand|Select|Wrap|Line Numbers
- <?php
- $query="SELECT * FROM campuses ORDER BY campus_id ASC";
- $result=mysql_query($query) or die(mysql_error());
- $rClr="ffffff";
- while($row=mysql_fetch_array($result)) {
- if($rClr=="ffffff"){
- $rClr="F7F7F7";
- }else{
- $rClr="ffffff";
- }
- $campid= $row['campus_id'];
- $campnam= $row['campus_name'];
- ?>
its a HTML table in which each campus name is fetched and shown and loop repeats itself until the last record is fetched
Expand|Select|Wrap|Line Numbers
- <tr>
- <td align="center" valign="middle"><table width="260" border="0" cellpadding="2" cellspacing="2">
- <tr>
- <td align="center" valign="middle" style="background-repeat:no-repeat;" class="Eventheading"><a href="eventsdetail.php?camp_id=<?php print $campid?>&campus_name=<?php print $campnam ?>" class="Eventheading" ><?php echo $row['campus_name'];?></a></td>
- </tr>
- </table></td>
- </tr>
Expand|Select|Wrap|Line Numbers
- <?php }?>
My problem is that the loop always repeat the content vertical mean row wise
such as
( campus name 1
Campus name 2
campus name 3 )
but i want it to be shown horizontally
LIke this ( campus name 1 Campus name 2 campus name 3)
any idea can any one